<style>
    .fl {
        float: left;
    }
    
    .fr {
        float: right;
    }
</style>
<div class="widget-head" style="margin-top:0;">
    <div class="widget-title">用户反馈</div>
</div>
<div class="layui-container" style="width:100%;">
    <div class="layui-clear">
        <a class="layui-btn layui-btn-danger think-btn" data-type="del" data-url="/admin/welcome/feedback_del">删除</a>
        <form method="GET" action="{:U('feedback')}" class="fr layui-form" style="width:400px;">
            <div class="layui-input-inline fl" style="width:100px;">
                <php>$types = ['email'=>'联系方式','desc'=>'反馈描述'];</php>
                <select name="searchtype">
                    <foreach name="types" item="vo" key="k">
                        <option value="{$k}" <if condition="$_GET['searchtype'] eq $k">selected</if>>{$vo}</option>
                    </foreach>
                </select>
            </div>
            <div class="layui-input-inline fr" style="width:300px;">
                <button class="layui-btn fr" lay-submit>搜索</button>
                <input type="text" class="layui-input fr" style="width:230px;" name="keywords" placeholder="请输入关键词" value="{$_GET['keywords']}">
            </div>
            <php> $condition = $_GET['searchtype'] && $_GET['keywords'] ? "/searchtype/".$_GET['searchtype']."/keywords/".$_GET['keywords'] : '';</php>
            <script>
                var condition = '{$condition}';
            </script>
        </form>
    </div>
    <table id="list" lay-filter="test"></table>
    <script type="text/html" id="barDemo">
        <div class="layui-btn-group action-btn">
            <a class="layui-btn layui-btn-danger layui-btn-xs mini_del" lay-event="del" data-url="/admin/welcome/feedback_del/ids/{{d.id}}">删除</a>
        </div>
    </script>


</div>

<script>
    layui.use(['think'], function() {
        var think = layui.think,
            $ = layui.jquery;

        //第一个实例
        think.render({
            elem: '#list',
            // height: 500,
            url: '/admin/welcome/getdata_feedback' + condition,
            toolbar: true,
            cols: [
                [ //表头
                    {
                        type: 'checkbox',
                        fixed: 'left'
                    }, {
                        field: 'id',
                        title: 'ID',
                        width: 80,
                        sort: true,
                        fixed: 'left'
                    }, {
                        field: 'username',
                        title: '用户名',
                        width: 150
                    }, {
                        field: 'email',
                        title: '联系方式',
                        width: 200
                    }, {
                        field: 'desc',
                        title: '反馈描述'
                    }, , {
                        field: 'create_time',
                        title: '反馈时间',
                        width: 177,
                        sort: true,
                        templet: function(d) {
                            return think_time(d.create_time, 'Y-m-d H:i:s'); //think_time()是think.js里面的方法
                        }
                    }, {
                        title: '操作',
                        width: 200,
                        align: 'center',
                        toolbar: '#barDemo'
                    }
                ]
            ]
        }, '{$_GET["searchtype"]}', '{$_GET["keywords"]}');

    });
</script>